const { sequelize, DataTypes } = require('../../utill/getSequelize')

//二级考核表
const Level_3_assessment = sequelize.define('Level_3_assessment', {
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true,
  },



  content: {//支撑环节
    type: DataTypes.STRING,
    allowNull: false,
  },

  target_id: {
    type: DataTypes.INTEGER,

  },

  proportion: {//总分数比例
    type: DataTypes.STRING,
    allowNull: false,
  },



  t_user_and_a_c_s_id: {
    type: DataTypes.INTEGER,
    allowNull: false,
  },


});

const { T_exam_target } = require('../t_exam_target')
Level_3_assessment.belongsTo(T_exam_target, {
  foreignKey: 'target_id',
  targetKey: 'id'
});


//同步模型和数据库表
(async () => {
  try {
    await sequelize.sync({ force: false });
    console.log('All models were synchronized successfully.');
  } catch (error) {
    console.log(error);
  }

})();

//提供出去
module.exports = { Level_3_assessment };